home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1266 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  701 b 

  1. Path: mer-news.ctron.com!vo
  2. From: vo@ctron.com (Huy Vo)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Macros in C (Disadvantages?)
  5. Date: 12 Jan 1996 16:00:58 GMT
  6. Organization: Cabletron Systems Inc
  7. Distribution: world
  8. Message-ID: <4d60jqINN8pe@mer-news.ctron.com>
  9. Reply-To: vo@porthos.ctron.com (Huy Vo)
  10. NNTP-Posting-Host: porthos.ctron.com
  11.  
  12. bvarley@yarrow.wt.com.au (bruce varley) wrote:
  13. >
  14. >Here is an a example that illustrates the danger(s) of macros.....
  15. >
  16. >#define A   7
  17. >#define B   4+5
  18. >
  19. >C = A * B.   This will produce  33.  
  20. >
  21. I don't make this kind of mistake since I know B is 9 :)
  22. Moral of the story: fully parenthesize any macros composed of more than one token.
  23.  
  24.  
  25. -- 
  26.     Huy Vo
  27.     vo@ctron.com
  28.